package org.jie.guider.java.mysql;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * JDBC 预编译操作数据库
 *
 * @author LiJie
 */
public class PreparedJdbc {

    public static void main(String[] args)
        throws ClassNotFoundException, SQLException {
        Class.forName(JdbcInfo.get().getDriverClassName());
        Connection conn = DriverManager.getConnection(JdbcInfo.get().getUrl(),
                                                      JdbcInfo.get().getUser(), JdbcInfo.get().getPassword());

        PreparedStatement statement =
            conn.prepareStatement("select * from account_info where recId = ?");
        statement.setString(1, "0");
        statement.execute();
        ResultSet result = statement.getResultSet();

        result.close();
        statement.close();
        conn.close();
    }
}
